<template>
	<view class="components-tmap-box">
		<!-- 小程序不支持$attrs -->
		<app-map
			:longitude="longitude"
			:latitude="latitude"
			:userLongitude="userLongitude"
			:userLatitude="userLatitude"
			:mapId="mapId"
			:minScale="minScale"
			:maxScale="maxScale"
			:scale="scale"
			:autoLocation="autoLocation"
			:layerStyle="layerStyle"
			@mapPan="(location, cb) => $emit('mapPan', location, cb)"
			@getMarkerArray="(cb) => $emit('getMarkerArray', cb)"
			@markerClick="(e) => $emit('markerClick', e)"
			@mapLocationChange="(e, cb) => $emit('mapLocationChange', e, cb)"
			@updateLocation="(e, cb) => $emit('updateLocation', e, cb)"
		></app-map>
	</view>
</template>

<script>
// #ifdef APP-PLUS|| H5
import appMap from './child/appMap.vue';
// #endif
// #ifdef MP-WEIXIN||MP-ALIPAY
import appMap from './child/mpMap.vue';
// #endif
export default {
	// #ifdef MP-WEIXIN
	options: {
		virtualHost: true
	},
	// #endif
	components: {
		appMap
	},
	props: {
		longitude: Number,
		latitude: Number,
		userLongitude: Number,
		userLatitude: Number,
		mapId: {
			type: String,
			default: `${new Date().getTime()}`.slice(-6)
		},
		minScale: Number,
		maxScale: Number,
		scale: Number,
		autoLocation: Boolean,
		layerStyle: Boolean
	}
};
</script>
<style scoped>
.components-tmap-box {
	width: 100%;
	height: 100%;
}
</style>
